package com.geo.geotool.entity.enmu;

/**
 * • @Description: 地理数据格式
 * • @author  : yell
 * • @date : 2021/12/13  9:21
 */
public enum GeoFormatEnum {
    WKT(0,"WKT",".*(POINT|POLYGON|LINESTRING|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON)(\\s?)(\\({1,3}).*"),
    GeoJSON(1,"GeoJSON",".*(\"\\s*coordinates\\s*\").*(:\\s*\\[.*\\]).*"),
    EsriJSON(2,"EsriJSON",".*\"\\s?(rings|paths|points)\\s?\".*|.*(\"\\s?(x|y)\\s?\").*(\"\\s?(x|y)\\s?\").*");

    private int code;
    private String type;
    private String pattern;
    GeoFormatEnum(int code,String type,String pattern){
        this.code = code;
        this.type = type;
        this.pattern = pattern;
    }

    public static GeoFormatEnum getGeoFileType(int code){
        for(GeoFormatEnum geoFormatEnum : values()){
            if(geoFormatEnum.getCode() == code){
                return geoFormatEnum;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getPattern() {
        return pattern;
    }

    public void setPattern(String pattern) {
        this.pattern = pattern;
    }
}
